package InterfaceBlogDemo;

public class Computer {
    public void powerON() {
        System.out.println("开电脑");
    }
    public void powerOff() {
        System.out.println("关电脑");
    }
    public void useUsb(IUsb usb) {
        usb.openDevice();
        if(usb instanceof Mouse) {
            Mouse mouse = (Mouse)usb;
            mouse.click();
        }
        if(usb instanceof Keyboard) {
            Keyboard keyboard = (Keyboard)usb;
            keyboard.typing();
        }
        usb.closeDevice();
    }
}
